<?php
$sSql="SELECT
shop_gallery.id
FROM
shop_gallery
WHERE
shop_gallery.`default` = 'Y' AND
shop_gallery.articleId = ".getParameter("id");

$rs=$GLOBALS["conn"]->Execute($sSql);

$sSql="UPDATE shop_articles SET galleryId=".$rs->fields["id"]." WHERE id=".getParameter("id");;
$GLOBALS["conn"]->Execute($sSql);

?>